package com.ruoyi.daily.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.daily.domain.dto.*;
import com.ruoyi.daily.domain.vo.*;
import com.ruoyi.daily.service.CustomerServiceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author cmz
 * @Date 2024-05-30 15:08
 */
@RestController
@RequestMapping("/daily/server")
@Api(tags = "经营日报-客服报表")
public class CustomerServiceController {
    @Resource
    private CustomerServiceService customerServiceService;

    /*@ApiOperation("进港投诉Echarts")
    @PostMapping("/inboundComplaintEcharts")
    public R<List<EchartsDto>> inboundComplaintEcharts(@RequestBody ByDateVo byDateVo) {
        return customerServiceService.inboundComplaintEcharts(byDateVo);
    }*/
    
    @ApiOperation("客诉工单、进港投诉Echarts")
    @PostMapping("/customerComplaint")
    public R<EchartsCountDto> customerComplaint(@RequestBody CustomerComplaintVo byDateVo) {
        if (byDateVo.getType()==0){
            return customerServiceService.inboundComplaintEcharts(byDateVo.getByDateVo());
        }
        return customerServiceService.customerComplaint(byDateVo.getByDateVo());
    }
    
    /*@ApiOperation("客诉工单")
    @PostMapping("/customerComplaint")
    public R<List<EchartsDto>> customerComplaint(@RequestBody ByDateVo byDateVo) {
        return customerServiceService.customerComplaint(byDateVo);
    }*/

    @ApiOperation("投诉Echarts")
    @PostMapping("/complaintEcharts")
    public R<List<EchartsDto>> inboundComplaintEcharts(@RequestBody ServerByDateVo byDateVo) {
        Integer type = byDateVo.getType();
        if (type==0){
            return customerServiceService.complaintMyEcharts(byDateVo.getByDateVo());
        }else if (type==1){
            return customerServiceService.myComplaintEcharts(byDateVo.getByDateVo());
        }else {
            return customerServiceService.falseReceiptEcharts();
        }
    }

    @ApiOperation("进港投诉List")
    @PostMapping("/inboundComplaintList")
    public R<List<InboundComplaintDto>> inboundComplaintList(@RequestBody ByDateAndPageVo byDateAndPageVo) {
        return customerServiceService.inboundComplaintList(byDateAndPageVo);
    }
    
    @ApiOperation("虚假签收")
    @GetMapping("/falseReceipt")
    public R<FalseReceiptDto> falseReceipt() {
        return customerServiceService.falseReceipt();
    }
    
    /*@ApiOperation("工单解决率")
    @GetMapping("/workOrderSolve")
    public R<WorkOrderSolveDto> workOrderSolve() {
        return customerServiceService.workOrderSolve();
    }

    @ApiOperation("理赔账单-我投诉的Echarts")
    @PostMapping("/myComplaintEcharts")
    public R<List<EchartsDto>> myComplaintEcharts(@RequestBody ByDateVo byDateVo) {
        return customerServiceService.myComplaintEcharts(byDateVo);
    }

    @ApiOperation("理赔账单-我投诉的列表")
    @PostMapping("/myComplaintList")
    public R<List<MyComplaintListDto>> myComplaintList(@RequestBody ByDateAndPageVo byDateAndPageVo) {
        return customerServiceService.myComplaintList(byDateAndPageVo);
    }*/

    @ApiOperation("理赔账单-投诉列表")
    @PostMapping("/complaintList")
    public R<List<MyComplaintListDto>> myComplaintList(@RequestBody ComplaintByDateAndPageVo complaintByDateAndPageVo) {
        if (complaintByDateAndPageVo.getType()==0){
            return customerServiceService.complaintMyList(complaintByDateAndPageVo.getByDateAndPageVo());
        }
        return customerServiceService.myComplaintList(complaintByDateAndPageVo.getByDateAndPageVo());
    }

    /*@ApiOperation("理赔账单-投诉我的Echarts")
    @PostMapping("/complaintMyEcharts")
    public R<List<EchartsDto>> complaintMyEcharts(@RequestBody ByDateVo byDateVo) {
        return customerServiceService.complaintMyEcharts(byDateVo);
    }

    @ApiOperation("理赔账单-投诉我的列表")
    @PostMapping("/complaintMyList")
    public R<List<MyComplaintListDto>> complaintMyList(@RequestBody ByDateAndPageVo byDateAndPageVo) {
        return customerServiceService.complaintMyList(byDateAndPageVo);
    }*/
    
    @ApiOperation("工单解决率")
    @GetMapping("/workOrderResolutionRate")
    public R<WorkOrderResolutionRateDto> workOrderResolutionRate() {
        return customerServiceService.workOrderResolutionRate();
    }
}
